package com.bookhouse.service.impl;

import java.util.List;

import com.bookhouse.dao.PressDao;
import com.bookhouse.domain.Press;
import com.bookhouse.service.PressService;

public class PressServiceImpl implements PressService {

	private PressDao pressDao;

	public void setPressDao(PressDao pressDao) {
		this.pressDao = pressDao;
	}

	@Override
	public void savePress(Press press) {
		if (press.getId() != null && press.getId() > 0)
			pressDao.update(press);
		else
			pressDao.save(press);

	}

	@Override
	public List<Press> getAllPress() {
		return pressDao.findAll(Press.class);
	}

	@Override
	public void deletePress(int id) {
		pressDao.delete(Press.class, id);

	}

	@Override
	public Press getPress(int id) {
		return pressDao.get(Press.class, id);
	}

}
